LRU Cache
Cache 缓存
- 记忆
- 钱包 - 储物柜 3. 代码模块 CPU Socket https://www.sqlpassion.at/archive/2018/01/06/understanding-the- meltdown-exploit-in-my-own-simple-words/
LRU Cache
- Least Recently Used(最近最少使用)
- Hash Table + Double LinkedList(哈希表+双向链表)
- O(1) get and O(1) set
LFU Cache
- LFU - least frequently used(最近最不不常⽤用⻚页⾯面置换算法)
- LRU - least recently usd(最近最少使⽤用⻚页⾯面置换算法)
加深阅读
中⽂文⻚页⾯面: https://zh.wikipedia.org/wiki/快取⽂文件置換機制 英⽂文⻚页⾯面: https://en.wikipedia.org/wiki/Cache_replacement_policies
实战题⽬
- https://leetcode.com/problems/lru-cache/#/